package org.wx.io.netty.rpc.proxy;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.DefaultEventLoopGroup;

import java.lang.reflect.Proxy;
import java.util.concurrent.atomic.AtomicReference;

/**
 * @description:
 * @author: wangxun
 * @createDate: 2021/2/23
 * @version: 1.0
 */
public class RpcProxy {


    public static <T> T proxyGet(Class<T> interfaceInfo, ChannelHandlerContext ctx) throws InterruptedException {

        ClassLoader classLoader = interfaceInfo.getClassLoader();
        Class<?>[] methods = {interfaceInfo};
        return (T) Proxy.newProxyInstance(classLoader, methods, new ProxyInvokeHandler(ctx));

    }
}
